package questionanswer;

public class AnswerCopyFactory {
    public static Answer createNewAnswer(Answer answer) {
        if (answer == null) {
            return null;
        }
        switch (answer.getClass().getName()) {
            case "com.romaremez.testuser.src.questionanswer.OneAnswer":
                return new OneAnswer((OneAnswer)answer);
            case "com.romaremez.testuser.src.questionanswer.OneAnswerFromMany":
                return new OneAnswerFromMany((OneAnswerFromMany)answer);
            case "com.romaremez.testuser.src.questionanswer.MultipleAnswer":
                return new MultipleAnswer((MultipleAnswer)answer);
            default:
                return null; //todo return empty Answer;
        }
    }
}
